package io.gitee.xyuesheng.day05;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;

public class TestSet {
    @Test
    public void test() {
        Set<String> set = new HashSet<>();

        boolean result = set.add("张三");
        System.out.println(result);

        result = set.add("张三");
        System.out.println(result);

        result = set.add("李四");
        System.out.println(result);

        System.out.println(set.size());
    }

    @Test
    public void test2() {
//        Set<HomeworkTeacher> teachers=new HashSet<>();
    }

    @Test
    public void test3() {
        int[] arrays = {1, 1, 3, 3, 8, 9};

        Set<Integer> set = new HashSet<>();
        for (int i : arrays) {
            set.add(i);//自动拆箱    包装类型 =》 基本类型
        }

        System.out.println(set);
    }


}
